package com.tian;

import com.tian.common.factory.ApplicationContextFactory;
import com.tian.netty.core.ChargeCenterServer;
import com.tian.netty.util.Utility;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * 项目启动类
 * 说明：
 * 1、需要先启动redis/rabbitmq/mysql/elasticsearch/influxdb 等依赖服务
 *
 * influxd.exe -config influxdb.conf
 */
@Slf4j
@SpringBootApplication
@EnableScheduling
public class Application {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(Application.class, args);
        ApplicationContextFactory.setApplicationContext(context);
        Utility.setApplicationContext(context);
        try {
            ChargeCenterServer.start();
        } catch (Exception e) {
            log.error("netty start failed", e);
        }
    }
}
